<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>

<script type="text/javascript">
	
Function.prototype.addMethod = function (name, fn) {
	this.prototype[name] = fn;
	return this;
}

var F1 = function() {};
F1.addMethod('checkName', function() {
	console.error('验证姓名');
	return this;
}).addMethod('checkEmail', function() {
	console.error('验证邮件');
	return this;
}).addMethod('checkPassword', function() {
	console.error('验证密码');
	return this;
});

var f2 = new F1();
f2.checkName().checkEmail().checkPassword();

F1.checkName().checkEmail().checkPassword();

</script>

</body>
</html>